<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>修改订单</title>
<#include "/jspgou_sys/head.html"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});
function changeCount(){
	var totalWeight=0.0;
	$("#[id^='itemCount_']").each(function(){
		var ss=parseFloat(jQuery(this).val());
		var h=jQuery(this).attr("id");
		var index=h.split("_")[1];
		var weight=$("#itemWeight_"+index).html();
		totalWeight+=ss*weight;
	});
	ajaxtotalDeliveryFee($("#shippingId").val(),totalWeight);
	setTimeout(function(){changePrice()},1000);
}

function changePrice(){
	var totalPrice=0.0;
	$("#[id^='itemPrice_']").each(function(){
		var ss=parseFloat(jQuery(this).val());
		var h=jQuery(this).attr("id");
		var index=h.split("_")[1];
		var count=$("#itemCount_"+index).val();
		$("#subtotal_"+index).html("");
		$("#subtotal_"+index).html(count*ss);
		totalPrice+=count*ss;
	});
	$("#productPrice").html("");
	$("#productPrice").html(totalPrice);
	$("#total").html("");
	$("#total").html(parseFloat($("#freight").val())+totalPrice);
	$("#totalPice").val(parseFloat($("#freight").val())+totalPrice);
}

function changeFreight(){
	var ss=parseFloat($("#productPrice").html());
	$("#total").html("");
	ss+=parseFloat($("#freight").val());
	$("#total").html(ss);
}

function ajaxtotalDeliveryFee(d,w){
	$.post("../order/ajaxtotalDeliveryFee.do", {
		'deliveryMethod':d,
		'weight':w
	}, function(data) {
		if(data.status==1){
			$("#freight").val(data.freight);
			return data.freight;
		}
	},'json');
}

function statusChange(status){
	if(status==19){
      $("#jvForm").attr("action","o_returnMoney.do");
	}
	$("#status").val(status);
}
</script>
<style type="text/css">
.addr{padding:2px 0;}
.title{font-size:14px;}
</style>
</head>
<body>
<div class="body-box">
<div class="rhead">
	<div class="rpos"><@s.m "global.position"/>:  <@s.m "order.function"/> - 查看</div>
	<form class="ropt">
		<input type="button" value="<@s.m "global.backToList"/>" onclick="history.back();"/>
	</form>
	<div class="clear"></div>
</div>
<form id="jvForm" method="post" style="padding-top:5px">
	<input type="hidden" name="id" value="${order.returnOrder.id}"/>
	<input type="submit" value="审核" onclick="this.form.action='o_affirm.do'" <#if order.returnOrder.status!=1>disabled</#if>/>
	<input type="submit" value="退回" onclick="this.form.action='o_sendback.do'" <#if order.returnOrder.status!=1>disabled</#if>/>
	<input type="submit" value="收货" onclick="this.form.action='o_salesreturn.do'" <#if order.returnOrder.status!=4>disabled</#if> />
	<input type="submit" value="退款" onclick="this.form.action='o_reimburse.do'" <#if order.returnOrder.returnType=1><#if order.returnOrder.status!=5>disabled</#if><#else><#if order.returnOrder.status!=2>disabled</#if></#if> />
	<input type="submit" value="完成" onclick="this.form.action='o_accomplish.do'" <#if order.returnOrder.status!=6>disabled</#if>/>
</form>
<@p.form id="jvForm" action="o_update.do" labelWidth="12">
<@p.td colspan="2"><strong class="title"><@s.m "order.product"/></strong></@p.td><@p.tr/>
<@p.td colspan="2">
<@p.table value=order.items;item,i,has_next><#rt/>
	<@p.column code="product.code" style="width:100px"><#if item.product.productExt??>${item.product.productExt.code!}</#if></@p.column><#t/>
	<@p.column code="product.name" align="left"><img src="${item.product.productExt.coverImg!}" width="50" height="50"/>
	${item.product.name!}&nbsp;<#if item.productFash??>${item.productFash.attitude!}</#if></@p.column><#t/>
	<@p.column code="orderItem.finalPrice" style="width:110px">${item.salePrice!}</@p.column><#t/>
	 <@p.column code="单重" style="width:60px"><span id="itemWeight_${item.id}">${item.product.weight}</span></@p.column><#t/>
	<@p.column code="orderItem.count" style="width:60px">${item.count}</@p.column><#t/>
	<@p.column code="orderItem.subtotal" style="width:100px"><span id="subtotal_${item.id}"><#if item.productFash??>${item.productFash.salePrice*item.count!0}
	 <#else>${item.product.salePrice*item.count!0}</#if></span>
	</@p.column><#t/>
</@p.table>
</@p.td><@p.tr/>

<@p.td colspan="2"><strong class="title"><@s.m "order.info"/></strong></@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="订单编号">${order.code}</@p.td>
<@p.td colspan="1" width="50" label="order.createTime">${order.createTime}</@p.td><@p.tr/>

<@p.td colspan="1" width="50" label="order.status">
<@s.m "order.status.${order.status}"/>
</@p.td>
<@p.td colspan="1" width="50" label="order.paymentStatus">
<@s.m "order.paymentStatus.${order.paymentStatus}"/>
</@p.td>
<@p.tr/>
<@p.td colspan="1" width="50" label="order.shippingStatus">
<@s.m "order.shippingStatus.${order.shippingStatus}"/>
</@p.td>
<@p.td colspan="1" width="50" label="order.createTime">${order.shipping.name}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="order.productPrice"><span id="productPrice">${order.productPrice}</span></@p.td>
<@p.td colspan="1" width="50" label="order.freight" required="true">${order.freight}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="order.total"><span id="total">${order.total!0}</span>
<input type="hidden" id="totalPrice" name="totalPrice" value="${order.total!0}"/></@p.td>
<@p.td colspan="1" width="50" label="order.payment"><#if order.payment??>${order.payment.name}</#if></@p.td><@p.tr/>

<@p.td colspan="2"><strong class="title">退款详情</strong></@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="退款编号">${order.returnOrder.code!}</@p.td>
<@p.td colspan="1" width="50" label="申请时间">${order.returnOrder.createTime?string("yyyy-MM-dd HH:mm:ss")!}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="退款类型"><@s.m "orderReturn.returnType.${order.returnOrder.returnType!}"/></@p.td>


<@p.td colspan="1" width="50" label="退款状态"><@s.m "orderReturn.status.${order.returnOrder.status}"/></@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="退款金额">${order.returnOrder.money!0}</@p.td>
<@p.td colspan="1" width="50" label="退款原因">${order.returnOrder.shopDictionary.name!}</@p.td><@p.tr/>
<@p.td colspan="2" label="退款支付类型">${order.returnOrder.payType!}</@p.td><@p.tr/>
<@p.td colspan="2" label="支付宝账号">${order.returnOrder.alipayId!}</@p.td><@p.tr/>
<@p.td colspan="2" label="退款说明">${order.returnOrder.reason!}</@p.td><@p.tr/>

<@p.td colspan="2" label="图片凭证">
   <#list order.returnOrder.pictures as p>
     <table id="picTable${p_index}" border="0" style="float:left;">
      <tr>
        <td><img id="preImg${p_index}" src="${p.imgPath}" alt="预览" noResize="true" style="width:100px;height:100px;background-color:#ccc;border:1px solid #333"/></td>
     </tr>
   <tr>
   	   <td>
		<div style="width:100px;height:50px;">${p.description!}</div>
	   </td>
   </tr>
   </table>
   </#list>
 </@p.td><@p.tr/>

<@p.td colspan="2"><strong class="title">收货人信息</strong></@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="收货人姓名">${order.receiveName!}</@p.td>
<@p.td colspan="1" width="50" label="收货人电话">${order.receiveMobile!}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="收货人固定电话">${order.receivePhone!}</@p.td>
<@p.td colspan="1" width="50" label="收货人邮编">${order.receiveZip!}</@p.td><@p.tr/>
<@p.td colspan="2" label="收货人地址">${order.receiveAddress}</@p.td><@p.tr/>
<@p.td colspan="2" label="order.comments">${order.comments!}</@p.td><@p.tr/>
<@p.td colspan="2"><strong class="title">发送给客户的收货地址信息</strong></@p.td><@p.tr/>
<@p.td colspan="2" width="50" label="给客户提供的发货地址">${order.returnOrder.shippingAddress!}</@p.td><@p.tr/>
<@p.td colspan="2" width="50" label="需要提醒客户的事情">${order.returnOrder.remind!}</@p.td><@p.tr/>
</@p.form>
</div>
</body>
</html>